package com.example.album;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface AlbumRepository extends JpaRepository<Album, String> {
    Album save(Album album);
    Album findByAlbumId(String albumId);
    List<Album> findByStatusNot(int status);
    List<Album> findByOwnerIdAndStatusNot(String ownerId, int status);
    List<Album> findByAlbumIdIn(List<String> albumIds);
    long countAlbumsByOwnerIdAndStatusNot(String ownerId, int status);
    @Query("select a.albumId from Album a where a.ownerId = :ownerId and a.status <> :status")
    List<String> findAlbumIdsByOwnerIdAndStatusNot(String ownerId, int status);
    List<Album> findByCategoryId(String categoryId);
}
